gnttab: also validate PTE permissions upon destroy/replace
authorJan Beulich <jbeulich@suse.com>
Tue, 12 Sep 2017 12:45:13 +0000 (14:45 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 12 Sep 2017 12:45:13 +0000 (14:45 +0200)
commit16b1414de91b5a82a0996c67f6db3af7d7e32873
tree6e77c128f6fbcf3056dda6565d8b6e93b5c057d9
parent562a1c0f7ef3fbf3c122c3dfa4f2ad9dd51da9fe
gnttab: also validate PTE permissions upon destroy/replace

In order for PTE handling to match up with the reference counting done
by common code, presence and writability of grant mapping PTEs must
also be taken into account; validating just the frame number is not
enough. This is in particular relevant if a guest fiddles with grant
PTEs via non-grant hypercalls.

Note that the flags being passed to replace_grant_host_mapping()
already happen to be those of the existing mapping, so no new function
parameter is needed.

This is CVE-2017-14319 / XSA-234.

Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/mm.c